#include <gtk/gtk.h>
#include <stdio.h>

#include "gtkutils.h"

void sayHello() {
    printf("hello word\n");
}

static void activate(GtkApplication *app, gpointer user_data) {
    GtkWindow *window;
    GtkWidget *button;

    window = createWindowWithTitleSize(app, "gtk-login-panel-test", 200, 100);

    GtkBox *box1 = createBoxWithHorizntal(0);
    GtkBox *box2 = createBoxWithHorizntal(0);
    
    GtkBox *box3 = createBoxWithVertical(0);
    GtkBox *box4 = createBoxWithHorizntal(0);

    GtkLabel *label1 = createLabel("用户名: ");
    GtkLabel *label2 = createLabel("密    码: ");

    GtkEntry *entry1 = createEntry();
    GtkEntry *entry2 = createEntry();

    boxAppend(box1, label1);
    boxAppend(box1, entry1);
    boxAppend(box2, label2);
    boxAppend(box2, entry2);

    GtkSeparator *sep = createSeparatorWithHorizntal();

    GtkCheckButton *chkbtn1 = createCheckButton("Editable");
    GtkButton *btn1 = createButton("清空");
    GtkButton *btn2 = createButton("确认");

    boxAppend(box4, chkbtn1);
    boxAppend(box4, btn1);
    boxAppend(box4, btn2);

    boxAppend(box3, box1);
    boxAppend(box3, box2);
    boxAppend(box3, sep);
    boxAppend(box3, box4);

    setWindowChild(window, box3);
    showWindow(window);
}

int	main(int argc, char **argv) {

    GtkApplication* app =  createApplicationConnectActivate("gtk.login.panel", 
                                                            G_APPLICATION_FLAGS_NONE, 
                                                            activate);
    int status = runApplication(app, argc, argv);
    
    objectUnref(app);
    return status;
}

